#!/bin/bash
set -eu

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment

buildpackage 'simple-package'
buildpackage 'simple-package-update-conflict'
buildpackage 'conflicting-package-one'
buildpackage 'conflicting-package-distupgrade'

testpkgnotinstalled 'simple-package'
testpkgnotinstalled 'conflicting-package-one'
aptgetinstallpackage 'simple-package'
aptgetinstallpackage 'conflicting-package-one'
testpkginstalled 'simple-package'
testpkginstalled 'conflicting-package-one'

testequal '1-alt1' getpackageversion 'simple-package'
testequal '1-alt1' getpackageversion 'conflicting-package-one'

generaterepository_and_switch_sources "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS"

testsuccess aptget update

testsuccess aptget dist-upgrade -y

testequal '1-alt1' getpackageversion 'simple-package'
testequal '1-alt1' getpackageversion 'conflicting-package-one'
